package com.book.ordermanagement.command.receiver;

import com.book.pojo.Order;
import org.springframework.stereotype.Component;


/**
 * @param
 * @author oyz
 * @version 1.0.4
 * @description: 订单命令接收者
 * @date 2023/12/21 21:32
 */
@Component
public class OrderCommandReceiver {
    public void action(Order order){
        String orderState = order.getOrderState();
        switch (orderState){
            case "ORDER_WAIT_PAY":
                System.out.println("创建订单。。");
                System.out.println("存入DB");
                break;
            case "ORDER_WAIT_SEND":
                System.out.println("支付订单+"+order);
                System.out.println("存入DB");
                System.out.println("通知财务部门");
                System.out.println("通知物流部门");
                break;
            case "ORDER_WAIT_RECEIVE":
                System.out.println("订单发货"+order);
                System.out.println("存入DB");
                break;
            case "ORDER_FINISH":
                System.out.println("订单收货"+order);
                System.out.println("存入DB");
                break;
            default:
                throw new RuntimeException("Order state is error!");


        }
    }
}
